/*
 * EStockForm.java
 *
 * Created on June 18, 2008, 10:04 AM
 */

package View;

import javax.swing.UIManager;
import com.birosoft.liquid.*;
import Controller.StockController;

import Model.Congreso;
import Model.Reposicion;
import javax.swing.JFrame;
import javax.swing.JOptionPane;


/**
 *
 * @author  Gigin
 */
public class EStockForm extends javax.swing.JFrame {

   // Controller del Form
    private Congreso congreso;
    private Congreso congreso2;
    private StockController ecc;
    
  //Para manejar pantallas
    private PpalForm ppal; 
    private String modo;
    
    /** Creates new form ECajaForm */
    public EStockForm(String modo, Congreso cong) {
               
        this.setModo(modo);
        this.setCongreso(cong);
        
        //Se crea el controller de la pantalla
        ecc = new StockController();
        
        // Se carga el Look and Feel
        try {
            UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");   
        } catch (Exception e) { }
          LiquidLookAndFeel.setStipples(false);
          LiquidLookAndFeel.setShowTableGrids(true);
          
        //Se crean los componentes del Form 
        initComponents();
      
        
        if (this.getModo().compareTo("Oficina") == 0){
             //se cargan congresos
                 ecc.cargarCongresos();
              //se cargan congresos en el combo
                 cargarComboCongresos();
         }else 
             if(this.getModo().compareTo("Congreso") == 0){
                 ecc.setCongreso(this.getCongreso());
                 ecc.setCongreso2(this.getCongreso2());
                 jComboBox1.addItem(ecc.getCongreso());
                 jComboBox1.setEnabled(false);
           
            }
        
        
    }
    //* se cargan congresos en el combo*/
    public void cargarComboCongresos(){
         for (int i=0 ; i < ecc.getCongresos().size() ; i++){
             jComboBox1.addItem(ecc.getCongresos().get(i)); 
             if (((Congreso)ecc.getCongresos().get(i)).getIniciales().compareTo("OFICE")==0){
                jComboBox2.addItem(ecc.getCongresos().get(i)); 
             }
         }
             
             jComboBox2.setEnabled(false);
             jLabelStockOfic.setText(Integer.toString(congreso2.getStockDvd()));
             jLabel7.setText(Integer.toString(congreso2.getCantMalos()));
             jLabelBoxesOfic.setText(Integer.toString(congreso2.getCantBoxes()));
             jLabel12.setText(Integer.toString(congreso2.getCantBoxesMalos()));
    }

    
         
         
    
    
    /** Se cargan los valores de los Jtextfields de la pantalla*/
    
    
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jComboBox2 = new javax.swing.JComboBox();
        jButtonMasCheck = new javax.swing.JButton();
        jTextStockOfic = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabelStockOfic = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jTextAgregaStock = new javax.swing.JTextField();
        agregaStock = new javax.swing.JButton();
        jButtonMalo = new javax.swing.JButton();
        jTextAgregaBoxes = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jButtonBoxMalo = new javax.swing.JButton();
        jLabel13 = new javax.swing.JLabel();
        jLabelBoxesOfic = new javax.swing.JLabel();
        jTextStockOfic1 = new javax.swing.JTextField();
        jButtonMasCheck1 = new javax.swing.JButton();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jButtonVolver = new javax.swing.JButton();
        jComboBox1 = new javax.swing.JComboBox();
        jButtonMenosCheck = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jButtonMalos2 = new javax.swing.JButton();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jButtonMenosCheck1 = new javax.swing.JButton();
        jTextField2 = new javax.swing.JTextField();
        jButtonMalos3 = new javax.swing.JButton();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jTextAgregaStock1 = new javax.swing.JTextField();
        jTextAgregaBoxes1 = new javax.swing.JTextField();
        agregaStock1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jLabel22 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Monotype Corsiva", 1, 24));
        jLabel1.setForeground(new java.awt.Color(94, 148, 189));
        jLabel1.setText("Seleccionar un Congreso en STOCK CONGRESO");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(353, 353, 353)
                .addComponent(jLabel1)
                .addContainerGap(389, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(42, 42, 42)
                .addComponent(jLabel1)
                .addContainerGap(52, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "STOCK OFICINA", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 1, 12), new java.awt.Color(94, 148, 189))); // NOI18N
        jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jComboBox2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jComboBox2MouseClicked(evt);
            }
        });
        jComboBox2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox2ActionPerformed(evt);
            }
        });
        jPanel2.add(jComboBox2, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 20, 260, -1));

        jButtonMasCheck.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/next_normal.gif"))); // NOI18N
        jButtonMasCheck.setToolTipText("Ver siguiente");
        jButtonMasCheck.setBorderPainted(false);
        jButtonMasCheck.setContentAreaFilled(false);
        jButtonMasCheck.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/next_deshabilitado.gif"))); // NOI18N
        jButtonMasCheck.setFocusPainted(false);
        jButtonMasCheck.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/next_presionado.gif"))); // NOI18N
        jButtonMasCheck.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/next_mouse.gif"))); // NOI18N
        jButtonMasCheck.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonMasCheckActionPerformed(evt);
            }
        });
        jPanel2.add(jButtonMasCheck, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 210, 60, 30));
        jPanel2.add(jTextStockOfic, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 210, 40, -1));

        jLabel3.setText("Boxes Oficina:");
        jPanel2.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 110, -1, -1));
        jPanel2.add(jLabelStockOfic, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 90, 60, 20));

        jLabel6.setText("Dvd Malos:");
        jPanel2.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 140, -1, -1));
        jPanel2.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 140, 60, 20));
        jPanel2.add(jTextAgregaStock, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 320, 40, -1));

        agregaStock.setText("OK");
        agregaStock.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                agregaStockActionPerformed(evt);
            }
        });
        jPanel2.add(agregaStock, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 320, -1, 20));

        jButtonMalo.setText("Agregar");
        jButtonMalo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonMaloActionPerformed(evt);
            }
        });
        jPanel2.add(jButtonMalo, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 140, -1, 20));

        jTextAgregaBoxes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextAgregaBoxesActionPerformed(evt);
            }
        });
        jPanel2.add(jTextAgregaBoxes, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 350, 40, -1));

        jButton1.setText("OK");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel2.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 350, -1, 20));

        jLabel11.setText("Boxes Malos:");
        jPanel2.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 160, -1, -1));
        jPanel2.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 160, 60, 20));

        jButtonBoxMalo.setText("Agregar");
        jButtonBoxMalo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonBoxMaloActionPerformed(evt);
            }
        });
        jPanel2.add(jButtonBoxMalo, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 160, -1, 20));

        jLabel13.setText("Stock Oficina:");
        jPanel2.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 90, -1, -1));
        jPanel2.add(jLabelBoxesOfic, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 110, 60, 20));
        jPanel2.add(jTextStockOfic1, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 250, 40, -1));

        jButtonMasCheck1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/next_normal.gif"))); // NOI18N
        jButtonMasCheck1.setToolTipText("Ver siguiente");
        jButtonMasCheck1.setBorderPainted(false);
        jButtonMasCheck1.setContentAreaFilled(false);
        jButtonMasCheck1.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/next_deshabilitado.gif"))); // NOI18N
        jButtonMasCheck1.setFocusPainted(false);
        jButtonMasCheck1.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/next_presionado.gif"))); // NOI18N
        jButtonMasCheck1.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/next_mouse.gif"))); // NOI18N
        jButtonMasCheck1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonMasCheck1ActionPerformed(evt);
            }
        });
        jPanel2.add(jButtonMasCheck1, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 250, 60, 30));

        jLabel20.setText("Agregar Dvds (Cant):");
        jPanel2.add(jLabel20, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 320, -1, -1));

        jLabel21.setText("Agregar Boxes (Cant):");
        jPanel2.add(jLabel21, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 350, -1, -1));

        jLabel16.setText("Dvds:");
        jPanel2.add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 210, -1, -1));

        jLabel23.setText("Boxes:");
        jPanel2.add(jLabel23, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 250, -1, -1));

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "STOCK CONGRESO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 1, 12), new java.awt.Color(94, 148, 189))); // NOI18N
        jPanel3.setMinimumSize(new java.awt.Dimension(390, 346));
        jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jButtonVolver.setFont(new java.awt.Font("Verdana", 1, 10));
        jButtonVolver.setForeground(new java.awt.Color(94, 148, 189));
        jButtonVolver.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Volver_normal.gif"))); // NOI18N
        jButtonVolver.setToolTipText("Volver a la pantalla anterior");
        jButtonVolver.setBorderPainted(false);
        jButtonVolver.setContentAreaFilled(false);
        jButtonVolver.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Volver_deshabilitado.gif"))); // NOI18N
        jButtonVolver.setFocusPainted(false);
        jButtonVolver.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Volver_presionado.gif"))); // NOI18N
        jButtonVolver.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Volver_mouse.gif"))); // NOI18N
        jButtonVolver.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonVolverActionPerformed(evt);
            }
        });
        jPanel3.add(jButtonVolver, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 350, 120, 20));

        jComboBox1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jComboBox1MouseClicked(evt);
            }
        });
        jComboBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox1ActionPerformed(evt);
            }
        });
        jPanel3.add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 20, 310, -1));

        jButtonMenosCheck.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/previous_normal.gif"))); // NOI18N
        jButtonMenosCheck.setToolTipText("Ver anterior");
        jButtonMenosCheck.setBorderPainted(false);
        jButtonMenosCheck.setContentAreaFilled(false);
        jButtonMenosCheck.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/previous_deshabilitado.gif"))); // NOI18N
        jButtonMenosCheck.setFocusPainted(false);
        jButtonMenosCheck.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/previous_presionado.gif"))); // NOI18N
        jButtonMenosCheck.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/previous_mouse.gif"))); // NOI18N
        jButtonMenosCheck.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonMenosCheckActionPerformed(evt);
            }
        });
        jPanel3.add(jButtonMenosCheck, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 210, 60, 30));
        jPanel3.add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 210, 40, -1));

        jLabel4.setText("Boxes:");
        jPanel3.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 110, -1, -1));
        jPanel3.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 90, 60, 20));

        jLabel8.setText("Dvd Malos:");
        jPanel3.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 140, -1, -1));
        jPanel3.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 140, 60, 20));

        jButtonMalos2.setText("Agregar");
        jButtonMalos2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonMalos2ActionPerformed(evt);
            }
        });
        jPanel3.add(jButtonMalos2, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 140, -1, 20));

        jLabel14.setText("Stock:");
        jPanel3.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 90, -1, -1));
        jPanel3.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 110, 60, 20));

        jButtonMenosCheck1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/previous_normal.gif"))); // NOI18N
        jButtonMenosCheck1.setToolTipText("Ver anterior");
        jButtonMenosCheck1.setBorderPainted(false);
        jButtonMenosCheck1.setContentAreaFilled(false);
        jButtonMenosCheck1.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/previous_deshabilitado.gif"))); // NOI18N
        jButtonMenosCheck1.setFocusPainted(false);
        jButtonMenosCheck1.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/previous_presionado.gif"))); // NOI18N
        jButtonMenosCheck1.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/previous_mouse.gif"))); // NOI18N
        jButtonMenosCheck1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonMenosCheck1ActionPerformed(evt);
            }
        });
        jPanel3.add(jButtonMenosCheck1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 250, 60, 30));
        jPanel3.add(jTextField2, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 250, 40, -1));

        jButtonMalos3.setText("Agregar");
        jButtonMalos3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonMalos3ActionPerformed(evt);
            }
        });
        jPanel3.add(jButtonMalos3, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 160, -1, 20));
        jPanel3.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 160, 60, 20));

        jLabel19.setText("Boxes Malos:");
        jPanel3.add(jLabel19, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 160, -1, -1));

        jLabel10.setText("Agregar Dvds (Cant):");
        jPanel3.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 320, -1, -1));

        jLabel2.setText("Agregar Boxes (Cant):");
        jPanel3.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 350, -1, -1));
        jPanel3.add(jTextAgregaStock1, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 320, 40, -1));

        jTextAgregaBoxes1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextAgregaBoxes1ActionPerformed(evt);
            }
        });
        jPanel3.add(jTextAgregaBoxes1, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 350, 40, -1));

        agregaStock1.setText("OK");
        agregaStock1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                agregaStock1ActionPerformed(evt);
            }
        });
        jPanel3.add(agregaStock1, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 320, -1, 20));

        jButton2.setText("OK");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jPanel3.add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 350, -1, 20));

        jLabel22.setText("Dvds");
        jPanel3.add(jLabel22, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 210, -1, -1));

        jLabel17.setText("Boxes");
        jPanel3.add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 250, -1, -1));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 419, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 441, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(449, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 380, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(599, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

/** Acciones cuando se presiona el boton "Modificar saldo"*/
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
    congreso = new Congreso();
    congreso = (Congreso)jComboBox1.getSelectedItem();
    ecc.setCongreso(congreso);

    // Se muestra el nombre del congreso seleccionado en la pantalla
    
    
    jLabel1.setText(congreso.getNombreCong());
    jLabel5.setText(Integer.toString(congreso.getStockDvd()));
    jLabel15.setText(Integer.toString(congreso.getCantBoxes()));
    jLabel9.setText(Integer.toString(congreso.getCantMalos()));
    jLabel18.setText(Integer.toString(congreso.getCantBoxesMalos()));
}//GEN-LAST:event_jComboBox1ActionPerformed

private void jComboBox1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jComboBox1MouseClicked
    congreso = new Congreso();
    congreso = (Congreso)jComboBox1.getSelectedItem();
    ecc.setCongreso(congreso);
    
    // Se muestra el nombre del congreso seleccionado en la pantalla
    jLabel1.setText(congreso.getNombreCong());
 
}//GEN-LAST:event_jComboBox1MouseClicked

private void jButtonVolverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonVolverActionPerformed
     ppal.cargarFormulario();
     this.dispose();
}//GEN-LAST:event_jButtonVolverActionPerformed

private void jComboBox2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jComboBox2MouseClicked
    congreso2 = new Congreso();
    congreso2 = (Congreso)jComboBox1.getItemAt(jComboBox1.getItemCount()-1);
    ecc.setCongreso2(congreso2);


}//GEN-LAST:event_jComboBox2MouseClicked

private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed
    congreso2 = new Congreso();
    
    congreso2 = (Congreso)jComboBox1.getItemAt(jComboBox1.getItemCount()-1);
    ecc.setCongreso2(congreso2);

}//GEN-LAST:event_jComboBox2ActionPerformed

private void jButtonMasCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMasCheckActionPerformed
    if (ecc.esNumero(jTextStockOfic.getText(),1)){
        int valor = Integer.parseInt(jTextStockOfic.getText());
        congreso.setStockDvd(congreso.getStockDvd()+valor);
        congreso2.setStockDvd(congreso2.getStockDvd() - valor);
        ecc.setValStock(congreso, congreso2);
        jTextField1.setText("");
        jTextStockOfic.setText("");
        jLabelStockOfic.setText(Integer.toString(congreso2.getStockDvd()));
        jLabel5.setText(Integer.toString(congreso.getStockDvd()));
        jLabelBoxesOfic.setText(Integer.toString(congreso2.getCantBoxes()));
        jLabel15.setText(Integer.toString(congreso.getCantBoxes()));
    }
    System.out.println(jTextStockOfic.getText());
}//GEN-LAST:event_jButtonMasCheckActionPerformed

private void jButtonMenosCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMenosCheckActionPerformed
    if (ecc.esNumero(jTextField1.getText(),-1)){
        int valor = Integer.parseInt(jTextField1.getText());
        congreso.setStockDvd(congreso.getStockDvd() - valor);
        congreso2.setStockDvd(congreso2.getStockDvd() + valor);
        jTextField1.setText("");
        jTextStockOfic.setText("");
        jLabelStockOfic.setText(Integer.toString(congreso2.getStockDvd()));
        jLabel5.setText(Integer.toString(congreso.getStockDvd()));
        jLabelBoxesOfic.setText(Integer.toString(congreso2.getCantBoxes()));
        jLabel15.setText(Integer.toString(congreso.getCantBoxes()));        
        ecc.setValStock(congreso, congreso2);
        
    }
    
    System.out.println(jTextStockOfic.getText());
}//GEN-LAST:event_jButtonMenosCheckActionPerformed

private void agregaStockActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_agregaStockActionPerformed
    if (ecc.esNumero(jTextAgregaStock.getText(),0)){
        congreso2.setStockDvd(congreso2.getStockDvd() + Integer.parseInt(jTextAgregaStock.getText()));
        jLabelStockOfic.setText(Integer.toString(congreso2.getStockDvd()));
        ecc.setValStock(congreso, congreso2);
         //Aca hay que agregar un valor nuevo a congresoXReposicion. que lo agruege magoya no? jaja
                    Reposicion rep= new Reposicion(Integer.parseInt(jTextAgregaStock.getText()),'r');
                    rep.setCongreso(congreso2);
                    ecc.almacenarReposicion(rep);
                    
        jTextAgregaStock.setText("");
        JOptionPane.showMessageDialog(new JFrame(), "La cantidad fue agregada al Stock"," ", JOptionPane.INFORMATION_MESSAGE);
    }
    
}//GEN-LAST:event_agregaStockActionPerformed

private void jButtonMaloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMaloActionPerformed
    congreso2.setCantMalos(congreso2.getCantMalos()+1);
    congreso2.setStockDvd(congreso2.getStockDvd() - 1);
    jLabelStockOfic.setText(Integer.toString(congreso2.getStockDvd()));
    jLabel7.setText(Integer.toString(congreso2.getCantMalos()));
    ecc.setMalos(congreso2);
}//GEN-LAST:event_jButtonMaloActionPerformed

private void jButtonMalos2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMalos2ActionPerformed
    congreso.setCantMalos(congreso.getCantMalos()+1);
    congreso.setStockDvd(congreso.getStockDvd() - 1);
    jLabel5.setText(Integer.toString(congreso.getStockDvd()));
    jLabel9.setText(Integer.toString(congreso.getCantMalos()));
    ecc.setMalos(congreso);
}//GEN-LAST:event_jButtonMalos2ActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    if (ecc.esNumero(jTextAgregaBoxes.getText(),0)){
        congreso2.setCantBoxes(congreso2.getCantBoxes() + Integer.parseInt(jTextAgregaBoxes.getText()));
        jLabelBoxesOfic.setText(Integer.toString(congreso2.getCantBoxes()));
        ecc.setValStock(congreso, congreso2);
        jTextAgregaBoxes.setText("");
        JOptionPane.showMessageDialog(new JFrame(), "La cantidad fue agregada a Boxes"," ", JOptionPane.INFORMATION_MESSAGE);
    }
}//GEN-LAST:event_jButton1ActionPerformed

private void jButtonBoxMaloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBoxMaloActionPerformed
    congreso2.setCantBoxesMalos(congreso2.getCantBoxesMalos()+1);
    congreso2.setCantBoxes(congreso2.getCantBoxes() - 1);
    jLabelBoxesOfic.setText(Integer.toString(congreso2.getCantBoxes()));
    jLabel12.setText(Integer.toString(congreso2.getCantBoxesMalos()));
    ecc.setMalos(congreso2);
}//GEN-LAST:event_jButtonBoxMaloActionPerformed

private void jTextAgregaBoxesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextAgregaBoxesActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextAgregaBoxesActionPerformed

private void jButtonMasCheck1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMasCheck1ActionPerformed
    if (ecc.esNumero(jTextStockOfic1.getText(),1)){
        int valor = Integer.parseInt(jTextStockOfic1.getText());
        congreso.setCantBoxes(congreso.getCantBoxes()+valor);
        congreso2.setCantBoxes(congreso2.getCantBoxes() - valor);
        ecc.setValStock(congreso, congreso2);
        jTextField2.setText("");
        jTextStockOfic1.setText("");
        jLabelBoxesOfic.setText(Integer.toString(congreso2.getCantBoxes()));
        jLabel15.setText(Integer.toString(congreso.getCantBoxes()));
    }
    System.out.println(jTextStockOfic.getText());
}//GEN-LAST:event_jButtonMasCheck1ActionPerformed

private void jButtonMenosCheck1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMenosCheck1ActionPerformed
    if (ecc.esNumero(jTextField2.getText(),-1)){
        int valor = Integer.parseInt(jTextField2.getText());
        congreso.setCantBoxes(congreso.getCantBoxes() - valor);
        congreso2.setCantBoxes(congreso2.getCantBoxes() + valor);
        jTextField2.setText("");
        jTextStockOfic1.setText("");
        jLabelBoxesOfic.setText(Integer.toString(congreso2.getCantBoxes()));
        jLabel15.setText(Integer.toString(congreso.getCantBoxes()));        
        ecc.setValStock(congreso, congreso2);
        
    }
    
    System.out.println(jTextStockOfic.getText());
}//GEN-LAST:event_jButtonMenosCheck1ActionPerformed

private void jButtonMalos3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMalos3ActionPerformed
    congreso.setCantBoxesMalos(congreso.getCantBoxesMalos()+1);
    congreso.setCantBoxes(congreso.getCantBoxes() - 1);
    jLabel15.setText(Integer.toString(congreso.getCantBoxes()));
    jLabel18.setText(Integer.toString(congreso.getCantBoxesMalos()));
    ecc.setMalos(congreso);
}//GEN-LAST:event_jButtonMalos3ActionPerformed

private void jTextAgregaBoxes1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextAgregaBoxes1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextAgregaBoxes1ActionPerformed

private void agregaStock1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_agregaStock1ActionPerformed
 if (ecc.esNumero(jTextAgregaStock1.getText(),0)){
        congreso.setStockDvd(congreso.getStockDvd() + Integer.parseInt(jTextAgregaStock1.getText()));
        jLabel5.setText(Integer.toString(congreso.getStockDvd()));
        ecc.setValStock(congreso, congreso2);
        //Aca hay que agregar un valor nuevo a congresoXReposicion. que lo agruege magoya no? jaja
                    Reposicion rep= new Reposicion(Integer.parseInt(jTextAgregaStock1.getText()),'r');
                    rep.setCongreso(congreso);
                    ecc.almacenarReposicion(rep);
                    
        jTextAgregaStock1.setText("");
        JOptionPane.showMessageDialog(new JFrame(), "La cantidad fue agregada al Stock"," ", JOptionPane.INFORMATION_MESSAGE);
    }
}//GEN-LAST:event_agregaStock1ActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
     if (ecc.esNumero(jTextAgregaBoxes1.getText(),0)){
            congreso.setCantBoxes(congreso.getCantBoxes() + Integer.parseInt(jTextAgregaBoxes1.getText()));
            jLabel15.setText(Integer.toString(congreso.getCantBoxes()));
            ecc.setValStock(congreso, congreso2);
            jTextAgregaBoxes1.setText("");
            JOptionPane.showMessageDialog(new JFrame(), "La cantidad fue agregada a Boxes"," ", JOptionPane.INFORMATION_MESSAGE);
        }
}//GEN-LAST:event_jButton2ActionPerformed




public Congreso getCongreso(){
        return congreso;
    }
    
    public void setCongreso(Congreso val){
        this.congreso = val;
    }
    
public Congreso getCongreso2(){
        return congreso2;
    }
    
    public void setCongreso2(Congreso val){
        this.congreso2 = val;
    } 

public String getModo() {
        return modo;
    }
    
public void setModo (String val) {
        this.modo = val;
    }

public void setPpal(PpalForm p){
       this.ppal=p;
}


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton agregaStock;
    private javax.swing.JButton agregaStock1;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButtonBoxMalo;
    private javax.swing.JButton jButtonMalo;
    private javax.swing.JButton jButtonMalos2;
    private javax.swing.JButton jButtonMalos3;
    private javax.swing.JButton jButtonMasCheck;
    private javax.swing.JButton jButtonMasCheck1;
    private javax.swing.JButton jButtonMenosCheck;
    private javax.swing.JButton jButtonMenosCheck1;
    private javax.swing.JButton jButtonVolver;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelBoxesOfic;
    private javax.swing.JLabel jLabelStockOfic;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JTextField jTextAgregaBoxes;
    private javax.swing.JTextField jTextAgregaBoxes1;
    private javax.swing.JTextField jTextAgregaStock;
    private javax.swing.JTextField jTextAgregaStock1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextStockOfic;
    private javax.swing.JTextField jTextStockOfic1;
    // End of variables declaration//GEN-END:variables

}
